export const handleDate = function (format, value = '') {
    if (!value) return '--';
    let [_type, _date] = [format, new Date(value)];
    return _type
      .replace(/(yyyy)/, _date.getFullYear())
      .replace(/(M{2})/, () => _date.getMonth() < 9 ? '0' + (_date.getMonth() + 1) : (_date.getMonth() + 1).toString())
      .replace(/d{2}/, () => _date.getDate() < 10 ? '0' + (_date.getDate()) : _date.getDate().toString())
      .replace(/H{2}/, () => _date.getHours() < 10 ? '0' + (_date.getHours()) : _date.getHours().toString())
      .replace(/m{2}/, () => _date.getMinutes() < 10 ? '0' + (_date.getMinutes()) : _date.getMinutes().toString())
      .replace(/s{2}/, () => _date.getSeconds() < 10 ? '0' + (_date.getSeconds()) : _date.getSeconds().toString())
  }
